﻿// HSS.Data.IDataEntityUpdate.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       IDataEntityUpdate.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Data
{
	#region Using Directives
	using System.Data.SqlClient;

	#endregion

	#region IDataEntityUpdate
	/// <summary>
	/// IDataEntityUpdate marks a class as supporting the Update feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityUpdate
	{
		/// <summary>
		/// Update this item in a database.
		/// </summary>
		/// <param name="da">The current DataAccess instance</param>
		/// <param name="state">Optional state containing any additional data.</param>
		/// <returns>An int containing the return value of the database call.</returns>
		int Update(DataAccess da, object[] state);
	}
	#endregion

	#region IDataEntityUpdateTrx
	/// <summary>
	/// IDataEntityUpdateTrx marks a class as supporting the Update feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityUpdateTrx
	{
		/// <summary>
		/// Update this item in a database.
		/// </summary>
		/// <param name="cmd">The current SqlCommand instance</param>
		/// <param name="state">Optional state containing any additional data.</param>
		/// <returns>An int containing the return value of the database call.</returns>
		int Update(SqlCommand cmd, object[] state);
	}
	#endregion

	#region IDataEntityBatchUpdate
	/// <summary>
	/// IDataEntityBatchUpdate marks a class as supporting the UpdateBatch feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityBatchUpdate
	{
		/// <summary>
		/// Update this batch item in a database.
		/// </summary>
		/// <param name="da">The current DataAccess instance,</param>
		/// <returns>true if the item was successfully updated; otherwise false.</returns>
		bool UpdateBatchItem(DataAccess da);
	}
	#endregion

	#region IDataEntityBatchUpdateTrx
	/// <summary>
	/// IDataEntityBatchUpdateTrx marks a class as supporting the UpdateBatchTrx feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityBatchUpdateTrx
	{
		/// <summary>
		/// Update this batch item in a database.
		/// </summary>
		/// <param name="cmd">The current SqlCommand instance.</param>
		/// <returns>true if the item was successfully updated; otherwise false.</returns>
		bool UpdateBatchItem(SqlCommand cmd);
	}
	#endregion
}